import { applyMiddleware, createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import thunk from 'redux-thunk'
import rootReducer from './reducer'

const store = createStore(
  rootReducer,
  composeWithDevTools(applyMiddleware(thunk))
)

// 获取dispatch的类型
export type Appdispatch = typeof store.dispatch

// state的返回值类型
export type TypeState = ReturnType<typeof store.getState>

export default store
